package com.mofeng.myshop.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.mofeng.myshop.domain.dto.base.BaseDto;
import com.mofeng.myshop.domain.po.Project;
import com.mofeng.myshop.until.MyUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Builder(toBuilder = true)
public class ProjectDto extends BaseDto {

    @Schema(description= "图片路径")
    private String image;

    @Schema(description= "项目分类，区别调用什么表")
    private String type;

    @Schema(description= "小图标")
    private String iconImage;

    @Schema(description= "是否展示 0 展示 1 不展示 注意，不展示意思是前端将不会显示此分类")
    private String show;

    @Schema(description= "是否打开 0打开 1 关闭  注意，关闭意思是无法访问，但会显示禁止访问提示")
    private String open;

    @Schema(description= "steam直连链接")
    private String link;

    public Project toProject(){
        Project project = new Project();
        toBaseEntity(project);
        if (!MyUtil.StringUtil.isEmpty(this.image)){
            project.setImage(this.image);
        }
        if (!MyUtil.StringUtil.isEmpty(this.type)){
            project.setType(this.type);
        }
        if (!MyUtil.StringUtil.isEmpty(this.iconImage)){
            project.setIconImage(this.iconImage);
        }
        if (!MyUtil.StringUtil.isEmpty(this.show)){
            project.setShow(this.show);
        }
        if (!MyUtil.StringUtil.isEmpty(this.open)){
            project.setOpen(this.open);
        }
        if (!MyUtil.StringUtil.isEmpty(this.link)){
            project.setLink(this.link);
        }
        return project;
    }
}
